
use "/Users/shanhe/bulb_reg.dta"

*save data 
drop if avg_price >=40
drop if lifetime_yr>30

*Figure 1 
label variable price "Average bulb price"
twoway scatter avg_price lifetime_yr || lfit avg_price lifetime_yr, xtitle(Lifetime in Years) ytitle(Average Price in Dollars) 

*regresssion 
reg avg_price lifetime_yr, robust
reg avg_price lifetime_yr i..type i.base i.shape energy_star color_temp brightness energy_use, robust
npregress kernel avg_price lifetime_yr, vce(bootstrap, reps (100) seed (123))
